<?php
include("db_connect.php");

$on = true;



$userlimit = "";

if(isset($_GET['userlimit'])){
		$userlimit = $_GET['userlimit'];
}

$sql = "select * from tbl_banner_img ORDER BY time DESC";

if(!empty($userlimit) && $userlimit == "all"){
	$sql = "select * from tbl_banner_img ORDER BY time DESC";
}
if(is_numeric($userlimit) ){
	$sql .= " limit " .$userlimit;
}
$result = mysql_query($sql);
if(mysql_num_rows($result) <1){
	echo '<div style="padding:10px; display:block; background-color:gray;"><h3 style="color:white;" >No Item Found</h3></div>';
	
}
else{
echo "<form id='myformbanner'>";

echo "<table class='tbl_data_admin' border='1' id=''>

<thead>

<tr>
<th id='tbl_head_color' style=' width:10px; background-color:#ba3e3f; text-align:center;'> <input type='checkbox' name='checkall' onclick='checkedAllbanner();'/></th>
<th id='tbl_head_color' style='width:px; background-color:#ba3e3f; '>Title</th>
<th id='tbl_head_color' style='width:800px; background-color:#ba3e3f; '>Content</th>
</tr>

</thead>";


echo "<tbody >";
while($row = mysql_fetch_array($result))

  {

  if($on){
	
	echo "<tr class='even' id='banner_admin_width' >";
	$on= false;
  }
   else{
	echo "<tr class='odd' >";
	 $on= true;
  }
echo "<td style='text-align:center;' valign='top'><input type='checkbox' class='cd' name='checkbox' value='".$row['imgID']."'></td>";
echo	'<td valign="top">';
echo		'<div id="banner_admin_img"> ';
echo			'<img width="210" height="120" src="images/'.$row["imgName"].'" title="'.$row['title'].'">';
echo		'</div>';
echo		'<label>Title:<label>';
echo		'	<a href="#'.$row["imgName"].'">'.$row['title'].'</a>';
echo '</br>';
echo	'	<label>Posted: '.$row['time'].'<label>';
echo	'</td>';
echo	'<td valign="top" >';
echo	'	<p align="justify">'.$row['content'].'</p>';
echo	'</td>';

	
  echo "</tr>";

  }

echo "</tbody></table></form>";


}




mysql_close($conn);

?> 





